<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>tbox中vector容器的使用</title>
    <meta name="description" content="tbox的vector容器沿用了stl库中vector的命名，说白了就是以数组方式存储元素，也是整个容器库中最基础的容器之一。当然，在c中用tbox的vector跟用stl的vector其实差不了太多，用起来都很方便。先看个简单的例子熟悉下：    // 初始化一个维护大小写敏感字符串的vector容器，第一参数...">

    
    <meta name="keywords" content="tbox,vector,容器,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/cn/2016/08/04/uses-vector/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />

    <!-- css -->
    <link href="/css/reward.css" rel="stylesheet" type="text/css"> 




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/cn" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/?lang=0">
                    
                        <i class="fa fa-home"></i>English
                    </a>
                </li>

                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>项目
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/archive/">
                            
                        
                            <i class="fa fa-archive"></i>归档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/category/">
                            
                        
                            <i class="fa fa-th-list"></i>分类
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/tag/">
                            
                        
                            <i class="fa fa-tags"></i>标记
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/docs/">
                            
                        
                            <i class="fa fa-book"></i>文档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="https://xmake.io/#/zh-cn/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>社区
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/donation/">
                            
                        
                            <i class="fa fa-heart"></i>捐助
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/about/">
                            
                        
                            <i class="fa fa-user"></i>关于
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>tbox中vector容器的使用</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2016-08-04
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#tbox" title="Category: tbox" rel="category">tbox</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#tbox" title="Tag: tbox" rel="tag">tbox</a-->
        <a href="/cn/tag/#tbox" title="Tag: tbox" rel="tag">tbox</a>&nbsp;
    
        <!--a href="/tag/#vector" title="Tag: vector" rel="tag">vector</a-->
        <a href="/cn/tag/#vector" title="Tag: vector" rel="tag">vector</a>&nbsp;
    
        <!--a href="/tag/#%E5%AE%B9%E5%99%A8" title="Tag: 容器" rel="tag">容器</a-->
        <a href="/cn/tag/#容器" title="Tag: 容器" rel="tag">容器</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p>tbox的vector容器沿用了stl库中vector的命名，说白了就是以数组方式存储元素，也是整个容器库中最基础的容器之一。</p>

<p>当然，在c中用tbox的vector跟用stl的vector其实差不了太多，用起来都很方便。</p>

<p>先看个简单的例子熟悉下：</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code>    <span class="c1">// 初始化一个维护大小写敏感字符串的vector容器，第一参数设置元素自动增长大小，这里使用0表示默认大小
</span>    <span class="n">tb_vector_ref_t</span> <span class="n">vector</span> <span class="o">=</span> <span class="n">tb_vector_init</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">tb_element_str</span><span class="p">(</span><span class="n">tb_true</span><span class="p">));</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">vector</span><span class="p">)</span>
    <span class="p">{</span>
        <span class="c1">// 在头部插入元素
</span>        <span class="n">tb_vector_insert_head</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="s">"hi!"</span><span class="p">);</span>

        <span class="c1">// 在尾部插入元素
</span>        <span class="n">tb_vector_insert_tail</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="s">"how"</span><span class="p">);</span>
        <span class="n">tb_vector_insert_tail</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="s">"are"</span><span class="p">);</span>
        <span class="n">tb_vector_insert_tail</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="s">"you"</span><span class="p">);</span>

        <span class="c1">// 遍历打印所有元素
</span>        <span class="n">tb_for_all</span> <span class="p">(</span><span class="n">tb_char_t</span> <span class="k">const</span><span class="o">*</span><span class="p">,</span> <span class="n">cstr</span><span class="p">,</span> <span class="n">vector</span><span class="p">)</span>
        <span class="p">{</span>
            <span class="c1">// trace
</span>            <span class="n">tb_trace_d</span><span class="p">(</span><span class="s">"%s"</span><span class="p">,</span> <span class="n">cstr</span><span class="p">);</span>
        <span class="p">}</span>

        <span class="c1">// 销毁vector容器
</span>        <span class="n">tb_vector_exit</span><span class="p">(</span><span class="n">vector</span><span class="p">);</span>
    <span class="p">}</span>
</code></pre>
</div>

<p>里面的<code class="highlighter-rouge">tb_for_all</code>是用迭代器遍历容器，这个对所有的容器都支持，具体使用可以参考：<a href="/cn/2016/02/04/iterator/">迭代器的使用</a></p>

<p>vector不仅可以在头尾插入元素，还可以在指定索引的位置的前后插入元素：</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code>
<span class="c1">// 在索引1的位置，插入元素，新元素的索引为1
</span><span class="n">tb_vector_insert_next</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="s">"xxx"</span><span class="p">);</span>

<span class="c1">// 在索引1的前面插入元素， 新元素的索引为0
</span><span class="n">tb_vector_insert_prev</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="s">"xxx"</span><span class="p">);</span>

</code></pre>
</div>

<p>如果你要插入一连串重复的元素，可以使用 <code class="highlighter-rouge">tb_vector_ninsert_xxx</code> 版本：</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code>
<span class="c1">// 连续在尾部插入10个重复的"xxx"
</span><span class="n">tb_vector_ninsert_head</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="s">"xxx"</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span>

<span class="c1">// 连续在头部插入10个重复的"xxx"
</span><span class="n">tb_vector_ninsert_tail</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="s">"xxx"</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span>
</code></pre>
</div>

<p>如果要替换指定索引位置的元素内容，可以使用replace系列操作：</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code><span class="c1">// 替换索引5的元素内容为"xxx"，前提是这个元素原本就存在
</span><span class="n">tb_vector_replace</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="s">"xxx"</span><span class="p">);</span>
</code></pre>
</div>

<p>要删除指定索引的元素，更简单：</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code>
<span class="c1">// 删除索引位置5处的元素
</span><span class="n">tb_vector_remove</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="mi">5</span><span class="p">);</span>

<span class="c1">// 删除头部的一个元素
</span><span class="n">tb_vector_remove_head</span><span class="p">(</span><span class="n">vector</span><span class="p">);</span>

<span class="c1">// 删除尾部最后一个元素
</span><span class="n">tb_vector_remove_last</span><span class="p">(</span><span class="n">vector</span><span class="p">);</span>
</code></pre>
</div>

<p>像 替换、删除、插入等操作都有对应的 <code class="highlighter-rouge">ninsert/nreplace/nremove</code> 等批量处理连续重复数据的接口，这里就不细说了。。</p>

<p>在debug模式下，你还有使用dump接口，快速打印这个vector容器的所有数据信息，方便调试，不过只能在debug下使用哦：</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code><span class="cp">#ifdef __tb_debug__
</span><span class="c1">// dump 所有元素信息
</span><span class="n">tb_vector_dump</span><span class="p">(</span><span class="n">vector</span><span class="p">);</span>
<span class="cp">#endif
</span></code></pre>
</div>

<p>不仅仅是vector，所有容器的元素定义，全部采用<code class="highlighter-rouge">tb_element_xxx</code>的接口来定义，不仅能维护字符串，还能维护各种类型：</p>

<ul>
  <li>tb_element_long: 元素类型为整数：tb_long_t</li>
  <li>tb_element_size: 元素类型为整数：tb_size_t</li>
  <li>tb_element_uint8: 元素类型为整数：tb_uint8_t</li>
  <li>tb_element_uint16: 元素类型为整数：tb_uint16_t</li>
  <li>tb_element_uint32: 元素类型为整数：tb_uint32_t</li>
  <li>tb_element_str: 元素类型为字符串，支持：大小写敏感区分</li>
  <li>tb_element_ptr: 元素类型为指针，支持自定义free回调，释放指针对应的元素数据，相当于析构函数</li>
  <li>tb_element_mem: 元素类型为内存，一般用于内置结构体元素的维护，容器会吧整个结构体的数据维护在容器内部，同时也支持自定义free函数</li>
  <li>tb_element_obj: 元素类型为object对象，用于object模块中对象的维护，支持自动维护引用计数和对象释放</li>
</ul>

<p>一般情况下，自定义的各种结构体数据，可以通过<code class="highlighter-rouge">tb_element_ptr/tb_element_mem</code> 维护都能满足需求，这两者的区别在于，前者只维护指针，不维护数据，后者直接维护数据。</p>

<p>当然如果觉得这样还不能满足自己的需求，也可以自定义自己的element类型，只要继承下<code class="highlighter-rouge">tb_element_t</code>类型，实现下对应的api就行了。。</p>

<p>而且包括vector的所有容器，都跟algorithm算法库紧密相连，所有算法通过迭代器都可以完美适配各种容器，例如：</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code>
<span class="c1">// 使用通用算法接口remove移除所有内容为"xxx"的元素
</span><span class="n">tb_remove</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="s">"xxx"</span><span class="p">);</span>

<span class="c1">// 移除第一个内容为"xxx"的元素
</span><span class="n">tb_remove_first</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="s">"xxx"</span><span class="p">);</span>

<span class="c1">// 移除所有 &lt; 10的元素，tb_predicate_le是谓词函数，也可以实现自己的谓词逻辑
</span><span class="n">tb_remove_if</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="n">tb_predicate_le</span><span class="p">,</span> <span class="p">(</span><span class="n">tb_cpointer_t</span><span class="p">)</span><span class="mi">10</span><span class="p">);</span>

<span class="c1">// 统计所有 &gt; 10的元素个数
</span><span class="n">tb_count_all_if</span><span class="p">(</span><span class="n">vector</span><span class="p">,</span> <span class="n">tb_predicate_be</span><span class="p">,</span> <span class="p">(</span><span class="n">tb_cpointer_t</span><span class="p">)</span><span class="mi">10</span><span class="p">);</span>
</code></pre>
</div>

<p>其他算法，可以参考：<a href="/cn/2016/02/04/algorithm-sort-find/">排序和查找算法的使用</a></p>


        </article>
        <hr>

        <!-- baidu ads -->
        

        <!-- reward -->
        <div style="text-align: center;">
            <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
              <span>赏</span>
            </button>
            <div id="QR" style="display: none;">
                <div id="wechat" style="display: inline-block">
                  <img id="wechat_qr" src="/static/img/weixin.png" alt="WeChat Pay"/>
                  <p>微信打赏</p>
                </div>
                <div id="alipay" style="display: inline-block">
                  <img id="alipay_qr" src="/static/img/alipay.png" alt="Alipay"/>
                  <p>支付宝打赏</p>
                </div>
            </div>
        </div>

        
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
        

        
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        <p><strong>上一篇</strong> <a href="/cn/2016/08/04/switch-global-memory/">切换tbox全局内存分配器</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        <p><strong>下一篇</strong> <a href="/cn/2016/08/05/weixin-public/">TBOOX开通微信公众号</a></p>
        
    </div>
</div>


        <h2 id="comments">评论</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,       
  language: 'zh-CN',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">

            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    内容
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#english">English</a></li>
                    <li><a href="#similar_posts">相关文章</a></li>
                    <li><a href="#comments">评论</a></li>
                </ul>
            </div>


            <!-- baidu ads -->
            
            
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    链接
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- xmake courses -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    xmake 入门课程
                </div>
                <a href="https://xmake.io/#/zh-cn/about/course" target="_blank">
                <img src="/static/img/xmake-course.png" alt="course" width="256" height="193">
                </a>
            </div>

            <!-- qqgroup -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    技术交流群（QQ）
                </div>
                <img src="/static/img/qqgroup.png" alt="qqgroup" width="256" height="284">
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
